// 资源系统类型定义

export interface Resource {
  id: string
  name: string
  description: string
  category: ResourceCategory
  amount: number
  maxAmount: number
  productionRate: number
  consumptionRate: number
  icon: string
  color: string
  rarity: ResourceRarity
}

export type ResourceCategory = 'basic' | 'industrial' | 'special'

export type ResourceRarity = 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'

export interface ResourceProduction {
  resourceId: string
  baseRate: number
  efficiency: number
  modifiers: ProductionModifier[]
}

export interface ProductionModifier {
  id: string
  name: string
  type: 'building' | 'technology' | 'event' | 'diplomacy'
  value: number
  modifier: 'add' | 'multiply'
}

export interface ResourceCost {
  resourceId: string
  amount: number
}

export interface ResourceExchange {
  input: ResourceCost[]
  output: ResourceCost[]
  efficiency: number
  unlockConditions: import('./game').UnlockCondition[]
}

export interface ResourceEvent {
  id: string
  type: 'discovery' | 'depletion' | 'market_change' | 'disaster' | 'bonus'
  affectedResources: string[]
  effects: ResourceEventEffect[]
  duration: number
  probability: number
}

export interface ResourceEventEffect {
  type: 'production_rate' | 'capacity' | 'one_time_gain' | 'one_time_loss'
  value: number
  modifier: 'add' | 'multiply' | 'set'
}

export interface ResourceStorage {
  resourceId: string
  capacity: number
  upgradeLevel: number
  upgradeCosts: ResourceCost[]
}

export interface MarketPrice {
  resourceId: string
  basePrice: number
  currentPrice: number
  trend: 'rising' | 'falling' | 'stable'
  volatility: number
}

// 基础资源ID常量
export const BASIC_RESOURCES = {
  POPULATION: 'population',
  ENERGY: 'energy',
  FOOD: 'food',
  WATER: 'water',
  OXYGEN: 'oxygen',
  METAL: 'metal',
  CRYSTAL: 'crystal'
} as const

// 工业资源ID常量
export const INDUSTRIAL_RESOURCES = {
  ALLOY: 'alloy',
  ELECTRONICS: 'electronics',
  FUEL: 'fuel',
  MACHINERY: 'machinery',
  CHEMICALS: 'chemicals',
  COMPOSITES: 'composites',
  SEMICONDUCTORS: 'semiconductors',
  NANOMATERIALS: 'nanomaterials'
} as const

// 特殊资源ID常量
export const SPECIAL_RESOURCES = {
  ANTIMATTER: 'antimatter',
  DARK_MATTER: 'dark_matter',
  EXOTIC_MATTER: 'exotic_matter',
  QUANTUM_FOAM: 'quantum_foam',
  TEMPORAL_CRYSTALS: 'temporal_crystals',
  PSIONIC_ENERGY: 'psionic_energy'
} as const